<script setup lang="ts">
import { ref } from "vue";
import { formRules } from "./utils/rule";
import { FormProps } from "./utils/types";
import ReCol from "@/components/ReCol";
const props = withDefaults(defineProps<FormProps>(), {
  formInline: () => ({
    title: "新增",
    status: 1,
    code: "",
    name: "",
    warehouseId: 0
  })
});
const statusOptions = [
  {
    value: 1,
    label: "启用"
  },
  {
    value: 2,
    label: "禁用"
  }
];
const ruleFormRef = ref();
const newFormInline = ref(props.formInline);

function getRef() {
  return ruleFormRef.value;
}
defineExpose({ getRef });
</script>

<template>
  <el-form
    ref="ruleFormRef"
    :model="newFormInline"
    :rules="formRules"
    label-width="auto"
  >
    <el-row :gutter="30">
		<re-col :value="12" :xs="24" :sm="24">
		  <el-form-item label="仓库编码" prop="code">
		    <el-input
		      v-model="newFormInline.code"
		      clearable
					disabled
		      placeholder="请输入仓库编码"
		    />
		  </el-form-item>
		</re-col>
      <re-col :value="12" :xs="24" :sm="24">
        <el-form-item label="仓库名称" prop="name">
          <el-input
            v-model="newFormInline.name"
            clearable
            placeholder="请输入仓库名称"
          />
        </el-form-item>
      </re-col>
      
      <re-col :value="12" :xs="24" :sm="24">
        <el-form-item label="状态" prop="status">
          <el-select
            v-model="newFormInline.status"
            placeholder="请选择状态"
            class="w-full"
            clearable
          >
            <el-option
              v-for="(item, index) in statusOptions"
              :key="index"
              :label="item.label"
              :value="item.value"
            />
          </el-select>
        </el-form-item>
      </re-col>
    </el-row>
  </el-form>
</template>
<style scoped></style>
